ns16550: enable PCI serial card usage
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 31 Mar 2010 09:11:41 +0000 (10:11 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 31 Mar 2010 09:11:41 +0000 (10:11 +0100)
commitf2ff5d6628b3d4716273f0508434aa25e360b747
tree31ea4ce859f06d3e4883acc5854a2d1902c4301b
parent5657c1d9cbec292bb1f6aec6f2ea9df428ac4fc6
ns16550: enable PCI serial card usage

On some machine, there is no build-in serial port and no LPC
connection. To use serial port, we have to plug in a serial
card. Sometime BIOS doesn't enable the BARs for the PCI devices which
lead to that Xen can't use the add-in serial port for early log
print. This patch try to initialize the serial card and related PCI
bridge to make it usable for xen.

Usage:

Step 1. boot into bare metal Linux, get the information for the PCI
serial ports and the related PCI bridge. On my case:

#lspci -v
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90)
(prog-if 01     [Subtractive decode])
        Bus: primary=00, secondary=06, subordinate=06, sec-latency=32
        I/O behind bridge: 00005000-00005fff

06:02.0 Serial controller: Lava Computer mfg Inc Lava DSerial-PCI Port
A (prog-if 02 [16550])
        Region 0: I/O ports at 5000 [size=8]

Step 2. revise the grub.conf to include
'com1=115200,8n1,0xPPPP,0,<port-bdf>,<bridge-bdf> console=com1' for
xen cmdline. The 0xPPPP is the base I/O port address got for the
serial port in bare metal Linux. For my case, it is 0x5000. The 0
after 0xPPPP means enable polling model for the serial port. The
<port-bdf> is the serial port BDF, 06:02.0 in my case; the
<bridge-bdf> is the bridge BDF bebind which the serial card locates,
00:1e.0 for my case.

Signed-off-by: Wei Gang <gang.wei@intel.com>
xen/drivers/char/ns16550.c